Byte2IO
 
Component Byte2IO
General Two-Bytes Input/Output
Component Level: High
Typical Usage:
(Examples of a typical usage of the component in user code. For more information please see the page Component Code Typical Usage.)

Required component name is "Bt21".
Examples of a typical usage of this component follow:

(1)
The direction of the component is set to input.

 MAIN.C

void main(void)
{
  /* Wait until "10101010" is on the low port
     and "01010101" is on the high port */
  while( Bt21_GetVal() != 0x55AA );
    :
}

(2)
The direction of the component is set to output.

 MAIN.C

void main(void)
{
  Bt21_PutVal(0x55AA);
  /* "10101010" is on the low port and
     "01010101" is on the high port */
  
  for (;;) {
  /* Invert output level of first pin on the high port */
    Bt21_NegBit(8);
  }
}

(3)
The direction of the component is set to input/output.

 MAIN.C

void main(void)
{
  Bt21_SetDir(FALSE);  // Set input mode

  /* Wait until "0xFFFF" is on the ports */
  while( Bt21_GetVal() != 0xFFFF );
  
  Bt21_SetDir(TRUE);   // Set output mode

  Bt21_PutVal(0);      // Set "0x0000" on the ports
}